-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: (payments v3) Implement temporal specific error handling in connectors #109
Conversation
298336b
to
4bfed82
Compare
internal/connectors/plugins/public/mangopay/bank_account_creation.go
Outdated
Show resolved
Hide resolved
internal/connectors/plugins/public/mangopay/bank_account_creation.go
Outdated
Show resolved
Hide resolved
internal/connectors/plugins/public/mangopay/bank_account_creation.go
Outdated
Show resolved
Hide resolved
internal/connectors/plugins/public/mangopay/bank_account_creation.go
Outdated
Show resolved
Hide resolved
internal/connectors/plugins/public/mangopay/client/bank_accounts.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General report : type assertions on error feels like a bad practice for me. I would use errors.Is and implements the required methods.
Also, this kind of code is lossy :
return nil, fmt.Errorf("failed to make payout, status code %d: %w", statusCode, err)
The original error is lost. It prevent a client from being capable to unwrap the errors.
@gfyrag If you don't like type assertions let's discuss what some other options are? My general idea was to keep logic related to Temporal as close to the activity definitions as possible. I wanted to avoid having any logic related to temporal implemented in the client packages themselves since they should just be concerned with communicating with the various APIs. What I set out to achieve in this PR was:
I suppose instead of a having an abstracted
Is that really nicer than a quick type assertion though?
How so? the |
4bfed82
to
fe4567b
Compare
…rapper default error handler
… erros into temporal errors
fe4567b
to
a60b70b
Compare
2b92a2f
to
5dd55f0
Compare
@gfyrag I removed the type assertion in favour of a simple function that uses |
I'am adding a comment here: everytime you do a |
My bad, now the idiomatic way to do it is with the %w ! |
ENG-1371
This PR only covers plugins that use the httpwrapper. I'll get Ayden and Stripe in a different PR since this one is big enough.